<template>
  <div>
    <template>
      <el-table :data="Evalation" style="width: 100%">
        <el-table-column prop="SchoolSemester" label="学年学期" width="180"></el-table-column>
        <el-table-column label="学院" width="180">
          <template slot-scope="scope">
            <div v-for="item in College" :key="item.CollegeId">
              <span v-if="item.CollegeId==scope.row.CollegeId">{{item.CollegeName}}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="课程"  width="180">
          <template slot-scope="scope">
            <div v-for="item in Course" :key="item.CourseId">
              <span v-if="item.CourseId==scope.row.CourseId">{{item.CourseName}}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="授课老师"  width="180">
          <template slot-scope="scope">
            <div v-for="item in Workers" :key="item.WorkerId">
              <span v-if="item.WorkerId==scope.row.WorkerId">{{item.WorkerName}}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="操作"  width="180">
          <template slot-scope="scope">
            <span>
              <el-link type="primary">评价</el-link>
            </span>
          </template>
        </el-table-column>
      </el-table>
    </template>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user: "",
      Evalation: [],
      Course: [],
      College: [],
      Workers: []
    };
  },
  created() {
    this.GetWorkerEvaluationByStudent();
    this.GetAllCollege();
    this.GetAllCourse();
    this.GetAllWorker();
  },
  mounted() {},
  methods: {
    GetAllWorker() {
      this.$axios({
        method: "get",
        url: this.$api.GetAllWorker,
        data: {},
        params: {}
      }).then(res => {
        this.Workers = res.data.message;
      });
    },
    GetAllCourse() {
      this.$axios({
        method: "get",
        url: this.$api.GetAllCourse,
        data: {},
        params: {}
      }).then(res => {
        this.Course = res.data.message;
      });
    },
    GetAllCollege() {
      this.$axios({
        method: "get",
        url: this.$api.GetAllCollege,
        data: {},
        params: {}
      }).then(res => {
        this.College = res.data.message;
      });
    },
    GetWorkerEvaluationByStudent() {
      this.user = JSON.parse(sessionStorage.getItem("user"));
      this.$axios({
        method: "get",
        url: this.$api.GetWorkerEvaluationByStudent,
        params: {
          token: this.user.Token,
          Semester: 4
        }
      }).then(res => {
        this.Evalation = res.data.message;
      });
    }
  }
};
</script>

<style scoped>
</style>
